package com.heima.behavior.controller.v1;

import com.heima.api.behavior.ApBehaviorEntryControllerApi;
import com.heima.behavior.service.ApBehaviorEntryService;
import com.heima.model.behavior.pojos.ApBehaviorEntry;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/v1/behavior_entry")
public class ApBehaviorEntryController implements ApBehaviorEntryControllerApi {

    @Resource
    private ApBehaviorEntryService apBehaviorEntryService;

    /**
     * @Description 查询行为实体
     * @param userId app用户id
     * @param equipmentId 设备id
     * @return 查询结果
     */
    @GetMapping("/one")
    @Override
    public ApBehaviorEntry findByUserIdOrEquipmentId(@RequestParam("userId") Integer userId, @RequestParam(value = "equipmentId",required = false) Integer equipmentId) {
        return apBehaviorEntryService.findByUserIdOrEquipmentId(userId, equipmentId);
    }
}